<script>
  import { getContext } from 'svelte';
  const ctx = getContext('iconCtx') ?? {};
  let className = ctx.class || '';
  export { className as class };
  export let size = ctx.size || '24';
  export let role = ctx.role || 'img';
  export let color = ctx.color || 'currentColor';
  export let withEvents = ctx.withEvents || false;
  export let ariaLabel = 'taiko logo';
  export let title = {
    id: `taiko-logo-title-${Math.random().toString(36).substring(7)}`,
    title: ariaLabel,
  };
  export let desc = {
    id: `taiko-logo-desc-${Math.random().toString(36).substring(7)}`,
    desc: 'A taiko logo icon',
  };
  let ariaDescribedby = `${title.id || ''} ${desc.id || ''}`;
  let hasDescription = false;
  $: if (title.id || desc.id) {
    hasDescription = true;
  } else {
    hasDescription = false;
  }
</script>

{#if withEvents}
  <svg
    xmlns="http://www.w3.org/2000/svg"
    {...$$restProps}
    {role}
    width={size}
    height={size}
    class={className}
    aria-label={ariaLabel}
    aria-describedby={hasDescription ? ariaDescribedby : undefined}
    viewBox="0 0 34 31"
    on:click
    on:keydown
    on:keyup
    on:focus
    on:blur
    on:mouseenter
    on:mouseleave
    on:mouseover
    on:mouseout>
    {#if title.id && title.title}
      <title id={title.id}>{title.title}</title>
    {/if}
    {#if desc.id && desc.desc}
      <desc id={desc.id}>{desc.desc}</desc>
    {/if}

    <path
      d="M33.2553 24.5099L27.5116 16.7064C26.8877 15.8585 25.9637 15.3505 24.9798 15.2385C24.7558 15.2125 24.5558 15.0825 24.4438 14.8865C24.3298 14.6905 24.3178 14.4525 24.4078 14.2445C24.8018 13.3366 24.8258 12.2827 24.4018 11.3187L20.516 2.44326C19.9401 1.12534 18.6382 0.275391 17.2002 0.275391C15.7623 0.275391 14.4604 1.12734 13.8844 2.44326L9.99868 11.3187C9.5767 12.2827 9.5987 13.3366 9.99268 14.2445C10.0827 14.4525 10.0687 14.6905 9.95668 14.8865C9.84269 15.0825 9.6447 15.2125 9.42071 15.2385C8.43677 15.3505 7.51283 15.8585 6.88887 16.7064L1.14521 24.5099C0.293264 25.6679 0.207268 27.2198 0.925225 28.4657C1.64518 29.7096 3.0331 30.4116 4.46101 30.2536L14.0904 29.1817C15.1364 29.0657 16.0383 28.5197 16.6263 27.7237C16.7603 27.5417 16.9743 27.4338 17.2002 27.4338C17.4262 27.4338 17.6382 27.5417 17.7742 27.7237C18.3622 28.5197 19.2641 29.0657 20.3101 29.1817L29.9395 30.2536C31.3674 30.4136 32.7553 29.7116 33.4753 28.4657C34.1932 27.2198 34.1072 25.6679 33.2553 24.5099ZM12.5105 12.4327L16.4023 3.54719C16.5423 3.22921 16.8563 3.02322 17.2022 3.02322C17.5482 3.02322 17.8622 3.22921 18.0022 3.54719L21.894 12.4327C22.016 12.7126 21.99 13.0366 21.822 13.2926C21.654 13.5486 21.37 13.7026 21.062 13.7026H13.3405C13.0345 13.7026 12.7485 13.5486 12.5805 13.2926C12.4125 13.0366 12.3865 12.7126 12.5085 12.4327H12.5105ZM14.5084 25.9598C14.3704 26.2338 14.1024 26.4178 13.7984 26.4518L4.15903 27.5237C3.81505 27.5617 3.47907 27.3938 3.30508 27.0938C3.13109 26.7938 3.15309 26.4198 3.35907 26.1398L9.10873 18.3283C9.29072 18.0823 9.58271 17.9423 9.88869 17.9603C10.1947 17.9763 10.4706 18.1463 10.6246 18.4123L10.6306 18.4223L14.4804 25.0899L14.4864 25.0999C14.6404 25.3659 14.6484 25.6899 14.5104 25.9618L14.5084 25.9598ZM17.9922 22.944C17.8282 23.226 17.5282 23.402 17.2002 23.402C16.8743 23.402 16.5723 23.228 16.4083 22.946L13.4505 17.8243C13.2865 17.5423 13.2865 17.1924 13.4505 16.9104C13.6145 16.6284 13.9144 16.4524 14.2424 16.4524H20.1561C20.482 16.4524 20.784 16.6244 20.948 16.9084C21.112 17.1924 21.112 17.5404 20.948 17.8223L17.9922 22.944ZM31.0974 27.0938C30.9234 27.3938 30.5894 27.5637 30.2435 27.5257L20.604 26.4538C20.3001 26.4198 20.0321 26.2358 19.8941 25.9618C19.7561 25.6879 19.7641 25.3639 19.9181 25.0999L19.9241 25.0899L23.7738 18.4223L23.7799 18.4123C23.9338 18.1463 24.2098 17.9763 24.5158 17.9603C24.8218 17.9443 25.1138 18.0823 25.2958 18.3283L31.0454 26.1398C31.2514 26.4198 31.2714 26.7938 31.0994 27.0938H31.0974Z"
      fill={color} />
  </svg>
{:else}
  <svg
    xmlns="http://www.w3.org/2000/svg"
    {...$$restProps}
    {role}
    width={size}
    height={size}
    class={className}
    aria-label={ariaLabel}
    aria-describedby={hasDescription ? ariaDescribedby : undefined}
    viewBox="0 0 34 31">
    {#if title.id && title.title}
      <title id={title.id}>{title.title}</title>
    {/if}
    {#if desc.id && desc.desc}
      <desc id={desc.id}>{desc.desc}</desc>
    {/if}

    <path
      d="M33.2553 24.5099L27.5116 16.7064C26.8877 15.8585 25.9637 15.3505 24.9798 15.2385C24.7558 15.2125 24.5558 15.0825 24.4438 14.8865C24.3298 14.6905 24.3178 14.4525 24.4078 14.2445C24.8018 13.3366 24.8258 12.2827 24.4018 11.3187L20.516 2.44326C19.9401 1.12534 18.6382 0.275391 17.2002 0.275391C15.7623 0.275391 14.4604 1.12734 13.8844 2.44326L9.99868 11.3187C9.5767 12.2827 9.5987 13.3366 9.99268 14.2445C10.0827 14.4525 10.0687 14.6905 9.95668 14.8865C9.84269 15.0825 9.6447 15.2125 9.42071 15.2385C8.43677 15.3505 7.51283 15.8585 6.88887 16.7064L1.14521 24.5099C0.293264 25.6679 0.207268 27.2198 0.925225 28.4657C1.64518 29.7096 3.0331 30.4116 4.46101 30.2536L14.0904 29.1817C15.1364 29.0657 16.0383 28.5197 16.6263 27.7237C16.7603 27.5417 16.9743 27.4338 17.2002 27.4338C17.4262 27.4338 17.6382 27.5417 17.7742 27.7237C18.3622 28.5197 19.2641 29.0657 20.3101 29.1817L29.9395 30.2536C31.3674 30.4136 32.7553 29.7116 33.4753 28.4657C34.1932 27.2198 34.1072 25.6679 33.2553 24.5099ZM12.5105 12.4327L16.4023 3.54719C16.5423 3.22921 16.8563 3.02322 17.2022 3.02322C17.5482 3.02322 17.8622 3.22921 18.0022 3.54719L21.894 12.4327C22.016 12.7126 21.99 13.0366 21.822 13.2926C21.654 13.5486 21.37 13.7026 21.062 13.7026H13.3405C13.0345 13.7026 12.7485 13.5486 12.5805 13.2926C12.4125 13.0366 12.3865 12.7126 12.5085 12.4327H12.5105ZM14.5084 25.9598C14.3704 26.2338 14.1024 26.4178 13.7984 26.4518L4.15903 27.5237C3.81505 27.5617 3.47907 27.3938 3.30508 27.0938C3.13109 26.7938 3.15309 26.4198 3.35907 26.1398L9.10873 18.3283C9.29072 18.0823 9.58271 17.9423 9.88869 17.9603C10.1947 17.9763 10.4706 18.1463 10.6246 18.4123L10.6306 18.4223L14.4804 25.0899L14.4864 25.0999C14.6404 25.3659 14.6484 25.6899 14.5104 25.9618L14.5084 25.9598ZM17.9922 22.944C17.8282 23.226 17.5282 23.402 17.2002 23.402C16.8743 23.402 16.5723 23.228 16.4083 22.946L13.4505 17.8243C13.2865 17.5423 13.2865 17.1924 13.4505 16.9104C13.6145 16.6284 13.9144 16.4524 14.2424 16.4524H20.1561C20.482 16.4524 20.784 16.6244 20.948 16.9084C21.112 17.1924 21.112 17.5404 20.948 17.8223L17.9922 22.944ZM31.0974 27.0938C30.9234 27.3938 30.5894 27.5637 30.2435 27.5257L20.604 26.4538C20.3001 26.4198 20.0321 26.2358 19.8941 25.9618C19.7561 25.6879 19.7641 25.3639 19.9181 25.0999L19.9241 25.0899L23.7738 18.4223L23.7799 18.4123C23.9338 18.1463 24.2098 17.9763 24.5158 17.9603C24.8218 17.9443 25.1138 18.0823 25.2958 18.3283L31.0454 26.1398C31.2514 26.4198 31.2714 26.7938 31.0994 27.0938H31.0974Z"
      fill={color} />
  </svg>
{/if}
